17 步:我们需要更改每个精灵的旋转。我们可以在遍历我们的精灵列表时做到这一点。

  • 单击逻辑选项卡,然后单击.
  • Add Value代码底部的循环内。
  • my_var更改为rotate并将1更改为30

每次循环运行时, rotate会增加 30,这会导致下一个精灵在世界范围内旋转得更远。

To navigate the page using the TAB key, first press ESC to exit the code editor.

stage.set_background_color("lightblue") # sprite = codesters.Rectangle(x, y, width, height, "color") sprite = codesters.Rectangle(0, 0, 700, 100, "gold") sprite.turn_left(45) # sprite = codesters.Rectangle(x, y, width, height, "color") sprite = codesters.Rectangle(0, 0, 700, 100, "gold") sprite.turn_right(45) sprite = codesters.Sprite("earth") people_sprites = ['person1', 'person2', 'person3', 'person4', 'person5', 'person6', 'person7', 'person8','person9', 'person10', 'person11', 'person12'] rotate = 90 for value in people_sprites: # add code here sprite = codesters.Sprite(value) stage.wait(0.5) sprite.set_size(0.3) sprite.set_speed(5) sprite.move_forward(120) sprite.turn_right(90) sprite.rotate_origin(rotate)
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)